﻿@model IEnumerable<Planisoft.Entities.Contrato>

    
    <script type="text/javascript">
        
        $(function(){
            
            $("#send").click(function (){
                var id = $("#id").val();
                updateResult(id);
                return false;
            });

           function updateResult(id) {
            var url = '@Url.Action("Create", "Contrato", new { id="param-id"})';
            url = url.replace("param-id", id);
            $("#result").load(url);
                }

        });

        
    </script>

  
  
<fieldset class="informfieldset" > <legend>Listar Contrato </legend>

<h1 hidden="true"> 
    @Html.TextBox("id", "idTrabaj")    
</h1>
    

<p>
    <input type="button" id="send" value="Agregar Contrato" />
</p>


<table>
    <tr>
        <th>
            Codigo
        </th>
        <th hidden="true">
            IdTrabajador            
        </th>
        <th>
            TipoContrato
        </th>
        <th>
            Situacion Contrato
        </th>
        <th hidden = "true">
            IdAreaTrabajo
        </th>
        <th hidden ="true">
            IdFinalizaContrato
        </th>
        <th>
            FechInicio
        </th>
        <th>
            FechFin
        </th>
        <th hidden="true">
            Sueldo
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.IdContrato)
        </td>
        <td hidden="true">
            @Html.DisplayFor(modelItem => item.IdTrabajador)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TipoContrato.DesctipoCont)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SituacionContrato.DescSituaCont)
        </td>
        <td hidden="true"> 
            @Html.DisplayFor(modelItem => item.AreaTrabajo.DescAreaTrabajo)
        </td>
        <td hidden = "true">
            @Html.DisplayFor(modelItem => item.IdFinalizaContrato)
            
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FechInicio)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FechFin)
        </td>
        <td hidden="true">
            @Html.DisplayFor(modelItem => item.Sueldo)
        </td>
        <td title="Editar Contrato">
            @Ajax.ActionLink(" ", "Edit", "Contrato", new { id = item.IdContrato }, new AjaxOptions { UpdateTargetId = "result", Url = Url.Action("Edit", new { id = item.IdContrato }) }, new { style = "background: url('../../Content/themes/base/imgPlanisoft/editors.png') no-repeat center right;display:block; height:24px; width:24px;margin-top:-2px;text-decoration:none;" })                        
            @*@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })*@
        </td>
    </tr>
}
</table>
<div id="result"> </div>

</fieldset>
